
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="<%=basePath%>">
<title>总部</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/main.css">
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/js/main.js"></script>
<script src="${pageContext.request.contextPath}/js/MD5.js"></script>
<script src="${pageContext.request.contextPath}/js/city2.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/citySelect2.js"></script>

</head>
<body>
	<%@ include file="header.jsp"%>
	<%@ include file="left.jsp"%>
	<style>
.main_div {
	min-width: 1000px;
	min-height: 60px
}

.force-overflow1-1 {
	border: none
}

.buttonPic>span {
	color: #FFFFFF;
	font-size: 36px
}

.countyVipCount {
	font-size: 18px;
	line-height: 50px
}

.countyVipCount span {
	color: red
}

.pageChange {
	float: right;
	color: #337ab7;
}

.pageChange>span {
	cursor: pointer
}

.pageChange>span:hover {
	color: blue
}
</style>
	<div id="index"
		style="position: absolute;left: 180px;top: 80px;bottom: 0;right: 0;">
		<section id="main">
			<div class="scrollbar1-1" id="style1-1">
				<div class="main_div">
					<div class="main_title">
						<span>超市查询</span>
					</div>
				</div>
				<form class="form-inline" style="margin-top: 30px;margin-left: 40px">
					<div class="form-group" id="city_4">
						<label style="text-align: right">省市区：</label> <select
							class="form-control" id="prov42" data-code="510000"></select> <select
							class="form-control" id="city42" data-code="-1"></select> <select
							class="form-control" id="area42" data-code="-1"></select>
					</div>
					<div class="form-group">
						<label style="text-align: right">超市电话：</label> <input type="text" 
						class="form-control" id="phone"/>
					</div>
					<div class="form-group">
						<label style="margin-left:30px">超市状态：</label> <select
							class="form-control" id="status">
							<option value="-100">请选择</option>
							<option value="0">正常</option>
							<option value="1">暂停营业</option>
							<option value="2">申请冻结</option>
							<option value="3">已冻结</option>
							<option value="4">申请恢复</option>
							<option value="5">审核中</option>
						</select>
					</div>
					<div class="form-group">
						<button type="button" onclick="selectinfo()"
							class="btn btn-primary">立即查询</button>
					</div>
				</form>
				<script>
					var selectVal = new CitySelect({
						data : data,
						provId : "#prov42",
						cityId : '#city42',
						areaId : '#area42'
					});
				</script>
				<div class="force-overflow1-1">
					<table class="table table-condensed table-bordered table-hover"
						id="showTable" style="text-align: center">
						<tr style="background-color: #59c7d2">
							<th style="text-align: center">序号</th>
							<th style="text-align: center">超市名称</th>
							<th style="text-align: center">超市电话</th>
							<th style="text-align: center">超市所属区域</th>
							<th style="text-align: center">超市状态</th>
							<th style="text-align: center">查看超市设置</th>
							<th style="text-align: center">查看超市详情</th>
						</tr>
					</table>
					<div class="pageChange">
						<span onclick="prePage()">&nbsp;&nbsp;上一页&nbsp;&nbsp;</span> <span
							onclick="nextPage()">&nbsp;&nbsp;下一页&nbsp;&nbsp;</span> <em>
							&nbsp; 第&nbsp;<span id="pageNum">1</span>&nbsp;页&nbsp;&nbsp;
						</em> <em>/&nbsp;&nbsp;共&nbsp;<span id="totalpage"></span>&nbsp;页
						</em> <em>&nbsp;&nbsp;&nbsp;跳到第<input id="searchInput"
							style="width:46px" maxlength="4" type="text">页
						</em>
						<button class="btn btn-primary" onclick="searchPage()">搜索</button>
					</div>
					<input style="display:none" value="7" id="pageCount"
						name="pageCount" />
				</div>
			</div>
		</section>
	</div>
	<script>
		$(function() {
			selectinfo();
		})
			
	
		function selectinfo() {
			var pageNum = $("#pageNum").html();
			var pageCount = $("#pageCount").val();
			var phone=$("#phone").val();
			var status = $("#status").find("option:selected").val();
			var area = $("#area42").find("option:selected").val();
			if (area == -1) {
				area = null
			}
			if (status == -100) {
				status = null
			}
			if (!phone) {
				phone = null
			}
			$.post(urls + "headAction/getSuperMarketInfoByStatus",
				{
					pageNum : pageNum,
					pageCount : pageCount,
					status : status,
					agentRegion : area,
					phone:phone
				},
				function(data) {
					console.log(data)
					if (data) {
						var totalpage = data.totalpage;
						var orderlist = data.list;
						var table = $("#showTable");
						$("#vipCount").html(data.totalVip)
						$("tr").remove(".addtr");
						for (var i = 0; i < orderlist.length; i++) {
							var button;
							var status;
							var button1 = "<button class='btn btn-success' onclick='watchSuperSet(\"" + orderlist[i].id + "\",3)'>查看设置</button>";
							var button2 = "<button class='btn btn-info' onclick='watchSuperDetail(\"" + orderlist[i].id + "\",0)'>查看详情</button>";
							if (orderlist[i].status == 0) {
								status = "正常营业"
							} else if (orderlist[i].status == 1){
								status = "暂停营业"
							}else if (orderlist[i].status == 2){
								status = "申请冻结"
							}else if (orderlist[i].status == 3){
								status = "已冻结"
							}else if (orderlist[i].status == 4){
								status = "申请恢复"
							}else if (orderlist[i].status == 5){
								status = "审核中"
							}
							var append = "<tr class='addtr'><td>" + (i + 1) + "</td>" +
								"<td >" + orderlist[i].name + "</td>" +
								"<td>" + orderlist[i].phone + "</td>" +
								"<td>" + orderlist[i].agentName + "</td>" +
								"<td>" + status + "</td>" +
								"<td>" + button1 + "</td>" +
								"<td>" + button2 + "</td></tr>";
							table.append(append);
						}
						$("#totalpage").html(totalpage);
					}
				}
				, "json"
			)
		}
		function watchSuperSet(e){
		   location.href="${pageContext.request.contextPath}/YMGback/head/kaidian.jsp?superIDs="+e; 
		}
		function watchSuperDetail(e){
		   location.href="${pageContext.request.contextPath}/YMGback/head/onlySuperDetail.jsp?superIDs="+e; 
		}
	</script>
</body>
</html>